home *** CD-ROM | disk | FTP | other *** search
/ NeXT Enterprise Objects Framework 1.1 / NeXT Enterprise Objects Framework 1.1.iso / NextDeveloper / Headers / eoadaptors / Sybase / SybaseAdaptor.h < prev    next >
Encoding:
Text File  |  1995-02-13  |  5.0 KB  |  126 lines

  1. //  SybaseAdaptor.h
  2. //  Copyright 1994, NeXT Computer, Inc.
  3.  
  4. #import    <eoaccess/eoaccess.h>
  5. #import <sybfront.h>
  6. #import <sybdb.h>
  7.  
  8. @class SybaseChannel;
  9.  
  10. // Defines for keys in connection dictionary
  11. #define USERNAME    @"userName"
  12. #define HOSTNAME    @"hostName"
  13. #define DATABASENAME    @"databaseName"
  14. #define PASSWORD    @"password"
  15.  
  16. // If this key is found in the connection dictionary, its corresponding
  17. // value is set using DBSETLCHARSET() on the sybase login structure
  18. // before calling dbopen().
  19. #define CHARSETNAME    @"sybaseClientCharacterSet" 
  20.  
  21. // If this key is found in the connection dictionary, its corresponding
  22. // value is set using DBSETNATLANG() on the sybase login structure
  23. // before calling dbopen().
  24. #define NATLANGNAME    @"sybaseClientLanguage"
  25.  
  26. // If this key is found in the connection dictionary with a value of "Yes",
  27. // the adaptor enables the System 10 Password encryption feature before
  28. // attempting to open a connection
  29. #define ENCRYPTPASSWORD    @"sybasePasswordEncryption"
  30.  
  31. @interface SybaseAdaptor:EOAdaptor
  32. {
  33.     LOGINREC *_loginRecord;
  34.     NSMutableDictionary *_typesByName;
  35.     NSMutableArray *_channels;
  36.     NSMutableArray *_dbProcessPool;
  37.     int _dbProcessPoolLimit;
  38.     int _maxTextSizeDefault;
  39.     struct
  40.     {
  41.     unsigned hasConnectedWithDictionary:1;
  42.     unsigned shareDBProcesses:1;
  43.     unsigned _RESERVED:30;
  44.     } _flags;
  45.  
  46. }
  47.  
  48.  
  49. // Clients can configure the Sybase Adaptor and individual Sybase Channels
  50. // to handle errors and messages from the Sybase server in different ways.
  51. // When an error or message is recieved from the server on a DBProcess that
  52. // has been associated with a Sybase Adaptor Channel, the channel is consulted
  53. // for the appropriate behavior. When no channel is present, the Sybase
  54. // Adaptor Class is consulted. The following methods allow clients to specify
  55. // different behaviors for handling errors and messages. In addition, when
  56. // new channels are created, they will be initialized with the current values
  57. // of their parent adaptor.
  58. + (BOOL)logsErrors;
  59.     // YES if adaptors log errors. logsErrors is set to YES by default.
  60. + (void)setLogsErrors:(BOOL)yn;
  61.     // If set to YES Sybase adaptors will log errors with severity greater
  62.     // than severityLevelToIgnore.
  63.     
  64. + (BOOL)logsMessages;
  65.     // YES if adaptors log messages. logsMessages is set to YES by default.
  66. + (void)setLogsMessages:(BOOL)yn;
  67.     // If set to YES Sybase adaptors will log messages with severity greater
  68.     // than severityLevelToIgnore.
  69.  
  70. + (int)severityLevelToIgnore;
  71.     // Returns severity level of messages and errors that will be ignored by
  72.     // the default error and message handling routines. The default value for
  73.     // severityLevelToIngore is 0.
  74. + (void)setSeverityLevelToIgnore:(int)severityLevel;
  75.     // Sybase adaptors will ignore any messages and errors up to and equal to
  76.     // severityLevelToIgnore.
  77.  
  78. + (void)setTimeOutInterval:(int)seconds;
  79. + (int)timeOutInterval;
  80.  
  81. + (void)setLoginTimeOutInterval:(int)seconds;
  82. + (int)loginTimeOutInterval;
  83.  
  84. - (int)maxTextSizeDefault;
  85.     // Returns the maximum number of bytes to be returned from a sybase image
  86.     // to text field. The default is set to INT_MAX as defined for the host
  87.     // machine. This number can be overwritten on a channel by channel basis
  88.     // by sending the appropriate SQL to the channel using the
  89.     // evaluateExpression: method.
  90. - (void)setMaxTextSizeDefault:(int)textSize;
  91.     // Sets the default testsize. Any channels created after this method has
  92.     // been invoked will use the current textsize rather than the default.
  93.  
  94. - (int)typeForName:(NSString *)typeName;
  95.     // Returns the integer constant representing the type name as defined by
  96.     // Sybsae
  97.     
  98. // Sybase DBPROCESS structures are fairly heavyweight resources. Creating
  99. // and destroying them often tends to slow things down, and they are limited
  100. // in number by the database server. The Sybase adaptor can be configured
  101. // to share the DBPROCESS structs among all of its contexts. This is very
  102. // useful if you have created several channels but only a few are actually
  103. // in use simultaneously. When shareDBProcesses has been set to YES, channels
  104. // ask the adaptor for a DBPROCESS structure before each transaction and
  105. // gives the DBPROCESS back to the adaptor after each transaction has been
  106. // completed.
  107. // NOTE: When shareDBProcesses has been set to YES, you should never do
  108. // anything that sets the state of a DBPROCESS beyond its current transaction
  109. // (eg. sending the string @"set textsize 10" to a channels
  110. // evaluateExpression: method). This is because the DBPROCESS may be given
  111. // to another context in a subsequent transaction.
  112.  
  113. - (BOOL)shareDBProcesses;
  114.     // Returns yes if this adaptor has been configured to share sybase
  115.     // DBPROCESS structs when possible. The default value for shareDBProcesses
  116.     // is NO.
  117. - (void)setShareDBProcesses:(BOOL)yn;
  118.     // Configures the adaptor to shareDBProcesses or not. Must be invoked
  119.     // before any contexts are instantiated.
  120.     
  121. - (int)dbProcessPoolLimit;
  122. - (void)setDBProcessPoolLimit:(int)dbProcessPoolLimit;
  123.     
  124. @end
  125.  
  126.